Welcome to your PHP Practice Test 1. This test can be taken unlimited times. Signed in users can have their scores saved to be viewed later. Questions will be randomly displaying each test. Good luck! 1. What will be the output of the following code?<?php$newarray = str_split ("Lee@greetingcards.com",3);echo $newarray[0];?> LEE Lee l L2. Namespaces were offered in PHP 6 True False3. Which one of the following function finds the last occurrence of a character in a given string? strchr() strstr() strrchr() substr()4. Which one of the following will create an array containing 20, 15, 10, 5, 0 ? $arr = range( 20, 0, 4); $arr = range (20, 0, 5); $arr = range (0, 20, 5); $arr = range ( 0, 20, -5)5. Which one of the following returns the number of characters in a string? count() strcount() len() strlen()6. Which one of the following returns the full path and file name of the file. _FILE _FILE_ FILE_ _FILE_PATH7. PHP is a strictly typed language. True False8. Which one of the following function(s) converts data/time values into a Unix timestamp. gmdate() gmmktime() gmstrftime() getdate()9. Which one of the following is correct for E_ERROR? It’s a fatal run-time error It’s a warning It’s a compile-time error It’s a Notice10. Which of the following is/are the correct form(s) of a conditional statement in PHP? If statement If else statement Switch statement If else if statement All of the above11. In PHP, each statement needs to be end with dot. True False12. Methods are also known as instances. True False13. What is the output of the following code? <?php$x = 7;$y = 7.0;var_dump($x===$y);?> True False An Error Nothing will be displayed14. Which one of the following converts an entire string to uppercase? strtoUpper(); str_to_upper(); stringtoupper(); strtoupper();15. What will be the output of the echo number_format(3957459.7398); 3,957,459 3,957,460 3,957,459.74 3,957,459.7,39816. Which of the following will display the timestamp of the current system date and time? now(); timestamp(); timedate(); time();17. What is the output of the following PHP code?<?php//Let's find the number of o's in our string.$count = substr_count ("Hello World!","l");echo "There are " . $count . " instance (s) of \"l\" in Hello World!.";?> There are 3 instance (s) of “l” in Hello World. There are 3 instance (s) of l in Hello World. There are 3 instance (s) of l in Hello World!. There are 2 instance (s) of l in Hello World!.18. Which of the following function(s) will check if the file exists or not? file_exists( string file_name); file_exist( string file_name); if_file_exist(string file_name); fileexists(string file_name)19. Which of the following will turn off all error reporting in PHP? error_reporting(0); error_reporting(-1); error_reporting(1); error_reporting(E_ALL)20. What is the output of the following code?<?php$text = "Hello, how are you today? I am fine!";if (strlen ($text) >= 30){echo substr ($text,0,27);} else {echo $text;}?> Hello, how are you today? Hello, how are you today? I Hello, how are you today? I a Hello, how are you today? I am fine!21. What is the output of the following?function fun( &$arg ) { $return = $arg; $arg += 1; return $return; }$x = 3;$y = fun( $x );echo "x is ". $x . " and y is ". $y;?> x is 4 and y is 3 x is 4 and y is 4 x is 3 and y is 3 x is 4 and y is 422. Which function will return the total number of an array called $arr? count($arr) length($arr) len($arr) total($arr)23. In PHP you can’t redefine the following variables. Constants Global variables Server-side variables Local variables24. PHP variables are case sensitive. True False25. What is the output of the following code?$num = 5;echo 'He can speak $num++ different languages';?> He can speak 5 different languages He can speak 6 different languages He can speak $num++ different languages He can speak 5$num++ different languagesPlease fill in the comment box below.
Comments